package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel      string `gorm:"type:char(11);not null;comment:手机号"`
	Password string `gorm:"type:char(32);comment:密码"`
	State    int    `gorm:"type:tinyint;default:1;comment:状态:1.正常,2.冻结"`
}

func (u *User) Create() error {
	return DB.Create(&u).Error
}

func (u *User) UserInfo(UserTel string) error {
	return DB.Where("tel = ?", UserTel).First(&u).Error
}

func (u *User) UserInfoo(UserId int64) error {
	return DB.Where("id = ?", UserId).First(&u).Error
}
